import os

def read_text_file(file_path):
    list=[]
    try:
        with open(file_path, "r", encoding="utf-8") as file:
            for line in file:
                lineStr = line.strip()  # strip() 去除行末的换行符
                # print(lineStr[5:])
                list.append(lineStr[5:])
            return list
    except FileNotFoundError:
        print(f"文件不存在: {file_path}")
    except Exception as e:
        print(f"读取文件时出错: {e}")

def write_text_file(file_path,list):
    try:
        with open(file_path, "w", encoding="utf-8") as f:
            for item in list:
                f.write(f"{item}\n")  # 写入元素并添加换行符
    except FileNotFoundError:
        print(f"文件不存在: {file_path}")
    except Exception as e:
        print(f"读取文件时出错: {e}")


# 获取脚本的绝对路径
script_dir = os.path.dirname(os.path.abspath(__file__))
# 构建目标文件的路径
all_name_file_path = os.path.join(script_dir, "all_name.txt") 
ignore_name_file_path = os.path.join(script_dir, "ignore_name.txt") 
result_file_path = os.path.join(script_dir, "result.txt") 

all_workflow_name= read_text_file(all_name_file_path)
ignore_workflow_name= read_text_file(ignore_name_file_path)

result_list =[]
for name in all_workflow_name:
    if name not in (ignore_workflow_name):
        result_list.append(f"'{name}',")

write_text_file(result_file_path,result_list)